/**
 * Description:
 * Class Name:ListTest2
 * Date:2022/3/5 14:48
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第8章_Java集合._8_4_List集合._8_4_1_改进的List接口和ListIterator接口;

import java.util.ArrayList;

class A{
    public boolean equals(Object obj){
        return true;
    }
}

public class ListTest2 {
    public static void main(String[] args) {
        var books = new ArrayList();
        books.add("element1");
        books.add("element2");
        books.add("element3");
        System.out.println(books);


        books.remove(new A());			// 它调用A对象的equals()方法，由于总是返回true，所以遇谁删谁
        System.out.println(books);
        books.remove(new A());
        System.out.println(books);

    }
}
